/*
 * Copyright 2000-2020 ALPHA LAB.Inc All Rights Reserved.
 */
package com.alphalab.moonlight.demo.dao.internal;

/**
 * AirlineQueryDaoConst.
 * @author allen 
 * @version 1.0.0 2018年3月1日
 */
public final class AirlineQueryDaoConst { 
	 
	/**
	 * 私有构造函数,防止被实例化.
	 */
	private AirlineQueryDaoConst() {
	}

	/**
	 * 获取符合查询条件的航班信息.
	 */
	//拼接字符串使用StringBuffer的append方法比用字符串的加号效率更高，另sql的别名大小写需与PO对应
	public static final String SQL_GET_AIRLINELIST_BY_QUERYPARAM = new StringBuffer()
		.append(" SELECT DA.AIRLINE_ID airlineId, ")
		.append(" DA.FLIGHT_ID flightId, ")
		.append(" DA.DEPARTURE departure, ")
		.append(" DA.DESTINATION destination, ")
		.append(" DA.BEGIN_DATE beginDate, ")
		.append(" DA.END_DATE endDate, ")
		.append(" DA.PRICE price ")
		.append(" FROM DEMO_AIRLINE DA  {0} ")
		.append(" ORDER BY DA.PRICE ").toString(); 
	
	/**
	 * 获取符合查询条件的旅客行程信息.
	 */
	public static final String SQL_GET_PASSENGERTRAVEL_LIST_BY_QUERYPARAM = new StringBuffer()
		.append(" SELECT DU.USER_NAME username, ")
		.append(" DU.ID_NUMBER idNumber, ")
		.append(" DA.FLIGHT_ID flight, ")
		.append(" DA.DESTINATION destination, ")
		.append(" DA.BEGIN_DATE beginDate ")
		.append(" FROM DEMO_AIRLINE DA,DEMO_AIRLINE_USER_MENBERSHIP DM,DEMO_AIRLINE_USER DU ")
		.append(" WHERE DA.DEPARTURE=:DEPARTURE ")
		.append(" AND DA.BEGIN_DATE BETWEEN :BEGINTIME AND :ENDTIME ")
		.append(" AND DA.AIRLINE_ID = DM.AIRLINE_ID ")
		.append(" AND DM.USER_ID = DU.ID_NUMBER ")
		.append(" ORDER BY DA.BEGIN_DATE ").toString(); 
	
}
